﻿<mpc:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:mpc="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:NYTimes="clr-namespace:NYTimes;assembly=NYTimesSilverlightKit" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:nytvc="clr-namespace:NYTimes.ValueConverters;assembly=NYTimesSilverlightKit" 
    xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:local="clr-namespace:NYTMovieReviews" 
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
    xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 
    x:Class="NYTMovieReviews.MainPage"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480" Orientation="Portrait" SupportedOrientations="PortraitOrLandscape">
    
    <!--Page transition animation-->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    <mpc:PhoneApplicationPage.Resources>
    	<nytvc:VisibleIfTrueConverter x:Key="VisibleIfTrueConverter"/>
        <Storyboard x:Name="ResetPageTransitionList"/>
        <Storyboard x:Name="PageTransitionList"/>
        <nytvc:NumericFormatConverter x:Key="NumericFormatConverter" />
    </mpc:PhoneApplicationPage.Resources>
    <mpc:PhoneApplicationPage.ApplicationBar>
		<shell:ApplicationBar IsVisible="True" Opacity="0.5">
			<shell:ApplicationBarIconButton x:Name="SearchButton" IconUri="/icons/appbar.feature.search.rest.png" Text="search" Click="SearchButton_Click"/>
			<shell:ApplicationBarIconButton Click="ShowOptions" IconUri="/Images/Options.png" Text="Show Options"/>
		</shell:ApplicationBar>
    </mpc:PhoneApplicationPage.ApplicationBar>
        <mpc:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </mpc:PhoneApplicationPage.FontFamily>
    <mpc:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </mpc:PhoneApplicationPage.FontSize>
        <mpc:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
    </mpc:PhoneApplicationPage.Foreground>

    <!--Data context is set to sample data above-->
    <!--Data context is set to sample data above-->
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}"
		DataContext="{Binding Source={StaticResource ViewModelDataSource}}">
    	<VisualStateManager.VisualStateGroups>
    		<VisualStateGroup x:Name="VisualStateGroup">
    			<VisualStateGroup.Transitions>
    				<VisualTransition GeneratedDuration="0:0:0.4">
    					<VisualTransition.GeneratedEasingFunction>
    						<CubicEase EasingMode="EaseOut"/>
    					</VisualTransition.GeneratedEasingFunction>
    				</VisualTransition>
    			</VisualStateGroup.Transitions>
    			<VisualState x:Name="Normal"/>
    			<VisualState x:Name="Search">
    				<Storyboard>
    					<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="KeywordPane" d:IsOptimized="True"/>
    				</Storyboard>
    			</VisualState>
    		</VisualStateGroup>
    	</VisualStateManager.VisualStateGroups>
        <!--TitleGrid is the name of the application and page title-->
    	<Custom:Interaction.Triggers>
    		<Custom:EventTrigger>
    			<ic:GoToStateAction StateName="Normal" UseTransitions="False"/>
    		</Custom:EventTrigger>
    	</Custom:Interaction.Triggers>
    	<controls:Pivot Title="New York Times Movie Reviews" ItemsSource="{Binding Pivots}" ItemTemplate="{StaticResource PivotItemTemplate}" HeaderTemplate="{StaticResource PivotHeaderTemplate}" Margin="0,0,0,72" />
    	<Border x:Name="KeywordPane" Background="#FF515151" CornerRadius="10" VerticalAlignment="Top" Margin="12,145,12,0" RenderTransformOrigin="0.5,0.5">
    		<Border.RenderTransform>
    			<CompositeTransform TranslateY="660"/>
    		</Border.RenderTransform>

    		<Grid>
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition/>
    				<ColumnDefinition Width="Auto"/>
    			</Grid.ColumnDefinitions>
    			<TextBox x:Name="SearchBox" TextWrapping="Wrap" Text="{Binding Query, Mode=TwoWay}" VerticalAlignment="Top"/>
    			<Button Content="Search" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1">
    				<Custom:Interaction.Triggers>
    					<Custom:EventTrigger EventName="Click">
    						<ic:GoToStateAction StateName="Normal"/>
    					</Custom:EventTrigger>
    				</Custom:Interaction.Triggers>
    			</Button>

    		</Grid>

    	</Border>
    </Grid>
	

</mpc:PhoneApplicationPage>